





import time
import webbrowser
from selenium import webdriver
import requests
from selenium import webdriver
from selenium.webdriver.common.by import By

stop = True
i = 1
try:
    # r = redis.Redis(host='127.0.0.1', port=6379, decode_responses=True)
    # proxies = eval(r.get('proxies'))
    while stop:
        driver = webdriver.Chrome()
        driver.get('https://juejin.cn/user/3438928101384766')
        time.sleep(5)
        results = driver.find_elements(By.CLASS_NAME, "post-link")
        # icons = driver.find_elements(By.CLASS_NAME, "ion-close")
        # time.sleep(10)
        # webdriver.ActionChains(driver).move_to_element(icons[0]).click(icons[0]).perform()
        time.sleep(5)
        webdriver.ActionChains(driver).move_to_element(results[0]).click(results[0]).perform()
        time.sleep(5)
        webdriver.ActionChains(driver).move_to_element(results[1]).click(results[1]).perform()
        time.sleep(5)
        webdriver.ActionChains(driver).move_to_element(results[2]).click(results[2]).perform()
        time.sleep(5)
        webdriver.ActionChains(driver).move_to_element(results[3]).click(results[3]).perform()
        time.sleep(5)
        webdriver.ActionChains(driver).move_to_element(results[4]).click(results[4]).perform()
        time.sleep(5)
        webdriver.ActionChains(driver).move_to_element(results[5]).click(results[5]).perform()
        time.sleep(5)
        webdriver.ActionChains(driver).move_to_element(results[6]).click(results[6]).perform()
        time.sleep(3)
        webdriver.ActionChains(driver).move_to_element(results[1]).click(results[1]).perform()
        # for item in results:
        #     time.sleep(2)
        #     webdriver.ActionChains(driver).move_to_element(item).click(item).perform()

        # webdriver.ActionChains(driver).move_to_element(results[0]).click(results[0]).perform()
        i = i+1
        print(i)



except Exception as e:
    print('except:', e)
finally:
    stop = True
